package com.orangelife.mobile.property.biz;

import com.curry.android.util.StringUtil;

/**
 * <p>
 * Created by 吴格非 on 2016-10-28.
 * <p>
 *
 * @author 吴格非
 * @since v1.0.0
 */

public class PropertyBiz {

    private static String clearYear(String monthInfo) {
        if (!StringUtil.isBlank(monthInfo)) {
            if (monthInfo.contains("-")) {
                String[] ss = monthInfo.split("-");
                if (monthInfo.length() > 1) {
                    monthInfo = ss[1];
                }
            }
        }
        return monthInfo;
    }

    public static String getSelectedYearInfo(String firstMonth, String tailMonth) {
        String yearSelectedInfo;

        if (firstMonth.equals("") && tailMonth.equals("")) {
            yearSelectedInfo = "(未选择月份)";
        } else if (tailMonth.equals("")) {
            yearSelectedInfo = "(已选月份：" + PropertyBiz.clearYear(firstMonth) + ")";
        } else {
            yearSelectedInfo = "(已选月份：" + PropertyBiz.clearYear(firstMonth) + " - " + PropertyBiz.clearYear(tailMonth) + ")";
        }

        return yearSelectedInfo;
    }

}
